﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<CognisessWeb.Models.NewsModel>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

<div class="why">
       <div class="why_l">
           <ul class="why_l_a">
              <li>Latest News</li>
              <li><%= Html.ActionLink("Cogniblog", "Cogniblog", "Account")%></li>
              <li><%= Html.ActionLink("Press Releases", "PressReleases", "Account")%></li>
              <li><%= Html.ActionLink("Media Contacts", "Media", "Account")%></li>
              <%--<li><%= Html.ActionLink("images and Graphics Library", "Library", "Account")%></li>
              <li><%= Html.ActionLink("Twitter", "Twitter", "Account")%></li>
              <li><%= Html.ActionLink("Facebook", "Facebook", "Account")%></li>
              <li></li>--%>
           </ul>
       </div>
       
       <div class="latest_r">
          <h1 class="why_r_h1">Latest News</h1>
          <p class="latest_banner"><a href="#"><img src="../../Content/images/latest_banner1.jpg" alt="" width="650"/></a></p>
          <div class="latest">
             <div class="latest_a">Get news as it happens as we present a round-up of what's happening in the world of neuroscience and cognitive assessment. We are also regularly approached by different sections of the media for authoritative quotes and opinions.</div>
             <%foreach (var item in Model)
               {
                                     %>
                   
               
             <div class="latest_a">
                <p class="latest_a1"><%=item.Title %> <label><%=item.CreateTime %></label></p>
                <p class="latest_a2"><%=item.NewsName %> </p>
                <p><em><%=item.NewsContent %></em></p>
                <p><a href="/Account/NewsDetails/<%=item.Id %>">&lt;&lt; Read Full Article</a></p>
             </div>
             <%}
               
               int count = 0;
               CognisessService.AccountBLL bll = new CognisessService.AccountBLL();
               count = bll.GetNews(new CognisessDA.NewsInfo { }).Count; %>
               Pages (<%=count %>) :<%        
                                int p = Math.Max((+count - 1) / 2, 1);
                                int o = 0;

                                if (Request.QueryString["page"] != null && Request.QueryString["page"].ToString().Trim().Length > 0)
                                {
                                    o = int.Parse(Request.QueryString["page"].Trim().ToString());
                                }
                                if (o == 0 &&  count <=3)
                                {%>
                            <%=Html.Label("First")%>
                            <% 
                                }
                                else
                                {
                            if (o == 0)
                                    {%>
                            <%=Html.Label("First")%>
                            <%=Html.ActionLink("Next", "LatestNews?page=" + (o + 1) + "")%>
                            <%=Html.ActionLink("Last", "LatestNews?page=" + p + "")%>
                            <% 
                                         
                                    }
                            else if (o == p)
                                {%>
                            <%=Html.ActionLink("First", "LatestNews?page=0")%>
                            <%=Html.ActionLink("Reverse", "LatestNews?page=" + (p - 1) + "")%>
                            <%=Html.Label("Last")%>
                            <%}
                                else
                                {%>
                            <%=Html.ActionLink("First", "LatestNews?page=0")%>
                            <%=Html.ActionLink("Reverse", "LatestNews?page=" + (o - 1) + "")%>
                            <%=Html.ActionLink("Next", "LatestNews?page=" + (o + 1) + "")%>
                            <%=Html.ActionLink("Last", "LatestNews?page=" + p + "")%>
                            <%}
                                 }
                                
                                 %>
             
          </div>
       </div>
       
       
    </div>

</asp:Content>
